import axios from "axios";
import qs from "qs";
import config from "./config";

//let {host,appKey,menuVersion} = config;
let {host,appKey,accessToken} = config;
//星讯 - 列表
export function news(params,accessToken){
    return axios.get(`${host}/Personal/v200/post/getposts?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
export function newsold(params,accessToken){
    return axios.get(`${host}/Personal/v200/post/List?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
// //星讯 - 详情
export function newsDetail(params,accessToken){
    let token = ''
    if(accessToken){token = accessToken}else{token = config.accessToken}
    return axios.get(`${host}/Personal/v200/Post/Get?appKey=${appKey}&accessToken=${token}&${qs.stringify(params)}`);
}
//星讯 - 明星列表
export function SubAppList(params,accessToken){
    return axios.get(`${host}/Core/v200/App/SubAppList?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}

// export function newsDetail(){}
//星讯 - advert
export function advert(params,accessToken){
    return axios.get(`${host}/Personal/v200/Banner/List?appKey=${appKey}&${qs.stringify(params)}`);

}
//星讯 - 詳情 - 点赞列表
export function likeList(params,accessToken){
    return axios.get(`${host}/Personal/v200/Post/LikeList?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
//星讯 - 评论 - 列表
export function comments(params){
    return axios.get(`${host}/Personal/v200/Post/getcomments?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
//星讯 - 详情 - 点赞
export function postLike(params,accessToken){
    //let appKey = "lOaOWr2Kp37mjpugI5PkjbI-kCyWFXJr2aQot_CUBAKzCwqUgrNctNY5vY88VcyiBUazexDrG11FzEdk822pXw"
    return axios.post(`${host}/Personal/v200/Post/Likepost?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
//星讯 - 详情 - 取消点赞
export function postunLike(params,accessToken){
    //let appKey = "lOaOWr2Kp37mjpugI5PkjbI-kCyWFXJr2aQot_CUBAKzCwqUgrNctNY5vY88VcyiBUazexDrG11FzEdk822pXw"
    return axios.post(`${host}/Personal/v200/Post/Unlike?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
//星讯 - 评论 - 点赞
export function commentLike(params,accessToken){
    return axios.post(`${host}/Personal/v200/Post/LikeComment?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}
//星讯 - 评论 - 取消点赞
export function commentunLike(params,accessToken){
    return axios.post(`${host}/Personal/v200/Post/UnLikeComment?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`);
}

//星讯 - 评论 - 提交
export function commentPost(params,msg,accessToken){
    return axios.post(`${host}/Personal/v200/Post/createcomment?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`,
    {'Text':msg})
}
//星讯 - 详情 - 喜欢
export function newsLike(){}
//星讯 - 详情 - 举报
export function newsReport(params,appKey,msg,accessToken){
     return axios.post(`${host}/Personal/v200/Post/Report?appKey=${appKey}&accessToken=${accessToken}&${qs.stringify(params)}`,
     {'ReportTypeList':msg});
}
//星讯 - 详情 - 分享
export function newsShare(){}
//星讯 - 详情 - 统计
export function newsStatistic(){}